home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / intrvews / xgrab.lha / xgrab / include / gview.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-04-20  |  3.0 KB  |  102 lines

  1. /**
  2.    GRAB Graph Layout and Browser System
  3.  
  4.    Copyright (c) 1989, Tera Computer Company
  5.  **/
  6.  
  7. /* View of the graph, with perspective and everything  */
  8.  
  9. #ifndef gview_h
  10. #define gview_h
  11.  
  12. #include <InterViews/interactor.h>
  13. #include "graph.h"
  14.  
  15. class Graph;
  16. class FontHandler;
  17. class GraphData;
  18. class GraphFrame;
  19. class Perspective;
  20.  
  21. enum ModeType {bmode, cmode, emode};    /* browse, edit, or change mode? */
  22.  
  23. class GView : public Interactor 
  24. {
  25. public:
  26.     GView(Graph*);
  27.     void Adjust(Perspective&);
  28.     float GetMagnification() { return mag; }
  29.     void Draw();
  30.     void Redraw(Coord, Coord, Coord, Coord);
  31.     void Erase();
  32.     void Update();
  33.     void UpdateG();        // update the graph (i.e. draw it)
  34.     void UpdateP();        // just an interface to...
  35.     void UpdatePerspective();    // update the perspective
  36.     void CenterGraph();
  37.     void ChangePGrad(int, int);
  38.     void GetBounds(int*, int*, int*, int*, int*, int*, int*, int*);
  39.     void Handle(Event&);
  40.     void SetFHandler (FontHandler*);
  41.     boolean CurOnNonDummyNode();
  42.     boolean CurOnNode();
  43.     boolean CurOnEdge();
  44.     char *CurEdge();
  45.     char *CurNode();
  46.     void ChangeForceNL();
  47.     void ChangeForceEL();
  48.     void ChangeMarkDummy();
  49.     void ChangePA();
  50.     void FocusGraph(int, int, float);
  51.     void ChangeCurNodeLabel(char*);
  52.     void GetCurPos(int*, int*);
  53.     void SetupMove(char*, char*[], char*[], int, int);
  54.     void SetupInsArc();
  55.     void ChangeBC();
  56.     void SetFrame(GraphFrame*);
  57.     void ResetCurrent();
  58.     Canvas *GetCanvas();
  59. private:
  60.     GraphData** current;    // items under cursor 
  61.     int currno;            // number of elements in current 
  62.     Coord eventx, eventy;    // absolute version of ...
  63.     Coord cursorx, cursory;    // cursor position, in canvas coordinates
  64.     Graph* graph;        // the graph itself
  65.     GraphFrame* frame;        // so we can pick on the one upstairs
  66.     boolean okaytodraw;        // if not true, don't even bother drawing
  67.     boolean resizedone;        // we've just done a resize
  68.     boolean firsttime;        // we've just started up
  69.     float mag;            // magnifaction relative to initial position
  70.     Coord x0, y0;               // graph offset relative to initial position
  71.  
  72.     void Init();
  73.     void FixPerspective(Perspective*);
  74.     void Normalize(Perspective&);   /* normalize units */
  75.     float ScaleFactor(Perspective&);
  76.     void Zoom(Perspective&);
  77.     void Scroll(Perspective&);
  78.     void SetMagnification(float);
  79.  
  80.     void DoMove(Event&);
  81.     void DoInsArc(Event&);
  82.     void FindIntersect();
  83.     void Resize();
  84.     void translate (Coord, Coord, Coord*, Coord*);
  85.     void invtranslate (Coord, Coord, Coord*, Coord*);
  86.       // handle mouse input
  87.     void DoMiddleDown(Event&, ModeType);
  88.     void DoMiddleUp(Event&, ModeType);
  89.     void DoRightDown(Event&, ModeType);
  90.     void DoRightUp(Event&, ModeType);
  91.     void DoLeftDown(Event&, ModeType);
  92.     void DoLeftUp(Event&, ModeType);
  93.     void DoMouseMove(Event&);
  94.     void ResetCursor();
  95.     void Constrain(Event&);
  96.     boolean EKeyPressed(Event&);
  97.     boolean CKeyPressed(Event&);
  98.     boolean BKeyPressed(Event&);
  99. };
  100.  
  101. #endif
  102.